package com.suke.money;

import com.alibaba.dubbo.config.annotation.Reference;
import com.suke.money.service.IncomeRecordService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author: liush
 * @CreateTime: 2022-12-30  17:59
 * @Description: 定时器
 */
@Component
public class SpringTask {

    @Reference(interfaceClass = IncomeRecordService.class, version = "1.0.0", timeout = 20000)
    IncomeRecordService incomeRecordService;

    //@Scheduled(cron = "0/5 * * * * ?")
    public void test() {
        System.out.println("------begin-------");
        System.out.println("-------end--------");
    }

    //生成收益计划
    @Scheduled(cron = "0/5 * * * * ?")
    public void generatePlan() {
        System.out.println("---generatePlan---begin-------");
        incomeRecordService.generatePlan();
        System.out.println("---generatePlan----end--------");
    }
}
